/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package gagnatech.entity;

import java.io.Serializable;
import java.util.List;
import javax.persistence.*;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlTransient;

/**
 *
 * @author Dimitri
 */
@Entity
@Table(name = "mediatheque")
@XmlRootElement
@NamedQueries({
    @NamedQuery(name = "Mediatheque.findAll", query = "SELECT m FROM Mediatheque m"),
    @NamedQuery(name = "Mediatheque.findByIdmediatheque", query = "SELECT m FROM Mediatheque m WHERE m.idmediatheque = :idmediatheque"),
    @NamedQuery(name = "Mediatheque.findByName", query = "SELECT m FROM Mediatheque m WHERE m.name = :name")})
public class Mediatheque implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Basic(optional = false)
    @NotNull
    @Column(name = "IDMEDIATHEQUE")
    private Integer idmediatheque;
    @Size(max = 255)
    @Column(name = "NAME")
    private String name;
    @OneToMany(mappedBy = "mediathequeIdmediatheque")
    private List<User> userList;

    public Mediatheque() {
    }

    public Mediatheque(Integer idmediatheque) {
        this.idmediatheque = idmediatheque;
    }

    public Integer getIdmediatheque() {
        return idmediatheque;
    }

    public void setIdmediatheque(Integer idmediatheque) {
        this.idmediatheque = idmediatheque;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    @XmlTransient
    public List<User> getUserList() {
        return userList;
    }

    public void setUserList(List<User> userList) {
        this.userList = userList;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (idmediatheque != null ? idmediatheque.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof Mediatheque)) {
            return false;
        }
        Mediatheque other = (Mediatheque) object;
        if ((this.idmediatheque == null && other.idmediatheque != null) || (this.idmediatheque != null && !this.idmediatheque.equals(other.idmediatheque))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "gagnatech.entity.Mediatheque[ idmediatheque=" + idmediatheque + " ]";
    }
    
}
